﻿<%--<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;" />
    <title>宇商网_CRM系统</title>
    <link href="/Css/global.css" type="text/css" rel="stylesheet" />
    <link href="/Css/admin.css" type="text/css" rel="stylesheet" />
    <script src="/Scripts/jquery.js" type="text/javascript"></script>
    <script src="/Scripts/common.js" type="text/javascript"></script>
    <script src="/Scripts/m-lhgdialog/m-lhgdialog.js" type="text/javascript"></script>
    <style type="text/css">
        html
        {
            height: 100%;
            overflow: hidden;
        }
        body
        {
            overflow: hidden;
        }
    </style>
</head>
@{ List<functionmodel> childMenuList = ViewData["LeftMenus"] as List<FunctionModel>;}
@{ IList<FunctionModel> functions = ViewData["LeftMenus"] as List<FunctionModel>;}
@{ IEnumerable<FunctionModel> parentFunction = ViewData["ParentFunction"] as IEnumerable<FunctionModel>;}
<body>
    <div id="bodyWrap" class="body-wrap">
        <div class="header-wrap">
            <div class="header">
                <h1>
                </h1>
                <div class="header-info">
                    <div class="header-info-top clearfix">
                        <p class="header-info-time R">
                            当前时间：@(DateTime.Now.ToString("yyyy年MM月dd日"))
                            @(ESunny.CRM.WebSite.Models.CommHelper.GetChineseDayOfWeek(DateTime.Now.DayOfWeek.ToString()))</p>
                        <p class="header-info-notice R">
                            <span class="L">系统公告：</span> <span class="L cont" id="infoNotice">
                                @{ string str = ViewData["NoticeSys"].ToString();}
                                <a href="javascript:void(0);" title="@(str)">
                                    @if (str.Length < 40)
                                    {@(str)}
                                    else
                                    {
                                        @(str.Substring(0, 40))
                                    }</a> </span>
                        </p>
                    </div>
                    <div class="header-info-user R">
                        <p>
                            尊敬的<span class="org">@((ViewData["DepartmentName"] != "" ? ViewData["DepartmentName"] + "-" : "") + (ViewData["UserName"]))
                            </span>，欢迎您使用CRM系统！</p>
                        <a href="/Home/LoginOut" class="loginoff"><span>注销</span></a> <a href="/Home/LoginOut"
                            class="loginout"><span>退出</span></a>
                    </div>
                </div>
                <ul class="header-nav" id="headerNav">
                    <li id="navTag_home" class="cur"><a href="/Home/Main" target="toppage"><span>首页</span></a></li>
                    @{
                        int i = 0;
                    }
                    @foreach (FunctionModel function in parentFunction)
                    {
                        i++;
                        <li class='@(i == parentFunction.Count() ? "nobg" : "")'><a href="@function.URL" target="toppage" onclick="changeMenu(@function.FunctionID,'@function.URL');">
                            <span>
                                @function.Name
                            </span></a></li>
                    }
                </ul>
                <span class="header-r"></span>
            </div>
        </div>
        <div id="mainContent" class="mainContent clearfix">
            <div id="guid" class="guid L" state="open">
                <div id="guid-c" class="guid-c">
                    <dl style="display: none" name="dlMenu" moduleid="dlSearch">
                        <dt state="open"><span title="关闭" class=""></span><strong>常用查询</strong> </dt>
                        <dd class="tb-search left_searchbox">
                            <p class="s-ddl">
                                <label for="ddlType">
                                    搜索：</label><select id="ddlType" name="ddlType">
                                        <option value="txtCompanyName">公司名称</option>
                                        <option value="txtCompanyID">公司ID</option>
                                        <option value="txtUserName">联系人</option>
                                        <option value="txtContactMobile">手机号码</option>
                                        <option value="txtEmail">邮箱</option>
                                        <option value="txtNewAccountID">业务员</option>
                                        <option value="txtServiceAccountID">客服跟进人</option>
                                        <option value="txtAddress">通信地址</option>
                                    </select>
                            </p>
                            <p class="s-kw">
                                <input type="text" id="txtKeyword" onfocus="clearSearchTxt();" value="请输入查询内容" class="input-style-d" />
                            </p>
                            <p class="">
                                <input id="btnSearch" type="button" onclick="fastSearch();" value="查询" class="i-btn1" />
                            </p>
                        </dd>
                    </dl>
                    @foreach (FunctionModel topMenu in functions)
                    {
                        if (topMenu.Level > 0)
                        {                        
                        <dl style="display: none" name="dlMenu" moduleid="@(topMenu.ParentFunctionID)">
                            <dt state="open"><span title="关闭" class=""></span><strong>
                                @(topMenu.Name)</strong> </dt>
                            <dd>
                                @foreach (FunctionModel childMenu in childMenuList)
                                {
                                    if (childMenu.ParentFunctionID == topMenu.FunctionID)
                                    {
                                    <a href="@(string.IsNullOrEmpty(childMenu.URL) ? "#" : childMenu.URL)" target="toppage">
                                        @(childMenu.Name)</a>
                                    }
                                }
                            </dd>
                        </dl>
                        }
                    }
                </div>
            </div>
            <div id="guidop" class="guid-op">
            </div>
            <div id="main" class="main">
                <table class="main-frame">
                    <tr class="mf-t">
                        <td class="mf-t-l">
                            <span></span>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td class="mf-t-r">
                            <span></span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <iframe src="/Home/Main" id="toppage" name="toppage" frameborder="0" style="padding: 0;
                                margin: 0; height: 100%; border: 0;"></iframe>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr class="mf-b">
                        <td class="mf-b-l">
                            <span></span>
                        </td>
                        <td>
                        </td>
                        <td class="mf-b-r">
                            <span></span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        @*消息弹窗*@
        <div id="tipPopWin" style="width: 300px; height: 200px; position: fixed; position: absolute;
            z-index: 1979; bottom: 0; right: 0; display: none;" class="lhgdialog_crm">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tbody>
                    <tr>
                        <td class="lhgdg_leftTop_crm">
                        </td>
                        <td class="lhgdg_top_crm">
                            <div class="lhgdg_title_icon_crm" style="cursor: default">
                                <div class="lhgdg_icon_crm">
                                </div>
                                <div class="lhgdg_title_crm">
                                    消息提醒
                                </div>
                                <a target="_self" href="javascript:void(0);" class="lhgdg_xbtn_crm" onclick="$('#tipPopWin').hide();">
                                </a>
                            </div>
                        </td>
                        <td class="lhgdg_rightTop_crm">
                        </td>
                    </tr>
                    <tr>
                        <td class="lhgdg_left_crm">
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                <tbody>
                                    <tr>
                                        <td style="background-color: rgb(255, 255, 255); height: 132px;">
                                            <iframe id="tipPopWinIframe" scrolling="auto" frameborder="0" style="display: block;
                                                width: 100%; height: 100%;" src="/Msg/MsgAlert?Title=xx时有个会议&amp;ID=de08f0e6-7676-48db-83d7-9e0565aba684">
                                            </iframe>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </td>
                        <td class="lhgdg_right_crm">
                        </td>
                    </tr>
                    <tr>
                        <td class="lhgdg_leftBottom_crm">
                        </td>
                        <td class="lhgdg_bottom_crm">
                        </td>
                        <td class="lhgdg_rightBottom_crm" style="cursor: default;">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <script type="text/javascript">
        //导航高亮控制
        $('#headerNav>li').click(function () {
            var self = $(this);
            $('#headerNav>li').removeClass('cur').removeClass('nobg').last().addClass('nobg');
            self.addClass('cur');
            if (self.prev().length > 0) {
                self.prev().addClass('nobg');
            }
            setFull();
        });
        /**
        * 左侧菜单控制
        */
        $('#guid-c dt').click(function () {
            var self = $(this);
            var sState = self.attr('state');
            if (sState == 'open') {
                self.attr('state', 'close')
					.children('span').addClass('sb-op')
					.attr('title', '展开')
					.parent().next().slideUp('fast');
            } else {
                self.attr('state', 'open')
					.children('span').removeClass('sb-op')
					.attr('title', '关闭')
					.parent().next().slideDown('fast');
            }
        });
        //当前页获焦控制
        var $guidList = $('#guid-c dd>a');
        $guidList.click(function () {
            $guidList.removeClass('cur');
            $(this).addClass('cur');
            $('#' + $(this).parent('dd').prev('dt').attr('sort')).click();
        });


        $('#guidop').click(function () {
            var sState = $('#guid').attr('state');
            if (sState == 'open') {
                $('#guid').attr('state', 'close').hide();
                $(this).addClass('guid-op-open');

                if (! -[1, ] && !window.XMLHttpRequest) {
                    var nWinWidth = $(window).width();
                    $('#toppage').width(nWinWidth - 36); //186
                } else {
                    $('#main').css('marginLeft', '6px');
                }

            } else {
                $('#guid').attr('state', 'open').show();
                $(this).removeClass('guid-op-open');
                if (! -[1, ] && !window.XMLHttpRequest) {
                    var nWinWidth = $(window).width();
                    $('#toppage').width(nWinWidth - 196); //186
                } else {
                    $('#main').css('marginLeft', '166px');
                }
            }
        });


        //全局变量
        window.oDG = null; 	//一级弹层
        window.oWin = null; 	//当前操作页面，也就是id为toppage的iframe
        window.oSDG = null; 	//二级弹层
        window.oSWin = null;    //一级弹出层window
        window.oDGAlert = null;
        window.oDGConfirm = null;



        ///检测有没有消息
        var timerValue = 1000 * 20; // 20秒
        var $msgAlert = $('#tipPopWin');

        function checkMsg() {
            var url = "/Msg/GetRealTimeMsgJosn?" + Math.random();
            $.getJSON(url, function (data) {

                var $win = $(window);
                if (data != null) {
                    $('#tipPopWinIframe').attr('src', '/Msg/MsgAlert?Title=' + data.Title + "&ID=" + data.InBoxID);
                    $msgAlert.fadeIn();

                } else {
                    //alert("无消息")
                }
            });
        }
        $(document).ready(function () {
            checkMsg();
            window.setTimeout(checkMsg, timerValue);
        });
        //checkMsg();
        function closeMsgAlert() {
            $msgAlert.hide();
        }
        function changeMenu(moduleID, url) {
            var firstallow = true;

            $("dl[name=dlMenu]").each(
                    function () {
                        $(this).css('display', 'none');
                    }
                );


            $("dl[moduleID=" + moduleID + "]").each(
                    function () {
                        if (firstallow) {
                            $(this).addClass("guid-t");
                            firstallow = !firstallow
                        }
                        $(this).css('display', 'block');
                    }
                );
            if (url != null && url.toLowerCase() == '/home/serviceindex') {
                $("dl[moduleID='dlSearch']").each(
                    function () {
                        if (firstallow) {
                            $(this).addClass("guid-t");
                            firstallow = !firstallow
                        }
                        $(this).css('display', 'block');
                    }
                );
            }

        }

        //清空提示信息
        function clearSearchTxt() {
            var txtKeyword = $("#txtKeyword");
            //            if ($.trim(txtKeyword.val()) == "请输入查询内容") {
            //                $("#txtKeyword").val("");
            //            }
            $("#txtKeyword").val("");
        }

        function fastSearch() {
            var txtKeyword = $("#txtKeyword");
            if ($.trim(txtKeyword.val()) == "") {
                txtKeyword.val("请输入查询内容");
                return;
            }
            else if ($.trim(txtKeyword.val()) == "请输入查询内容") {
                return;
            }
            var selTypeValue = $("#ddlType").val();
            window.open("/AllSearch/SearchList?" + selTypeValue + "=" + $.trim(txtKeyword.val()));
        }

        changeMenu(99);

        /**
        * 满屏控制
        */
        function setFull() {
            var $win = $(window);
            var nWinHeight = $win.height();   //窗口高度
            var nWinHeightNotop = nWinHeight - 133;     //窗口高度去掉顶部导航条高度
            var nWinWidth = $win.width();
            var nGHeight = $('#guid-c').outerHeight();      //左侧导航菜单高度

            $('#guid-c').height(nWinHeightNotop - 45);
            $('#guidop').css('marginTop', (nWinHeightNotop / 2) - 23);
            $('#toppage').height(nWinHeightNotop - 22);

            /*if(!-[1,]&&!window.XMLHttpRequest){
            if(nWinWidth <= 1200){
            $('html').css('overflow','auto');
            $('body').css('width', '1200px');
            }else{
            // $('html').css('overflow','hidden');
            $('body').css('width', 'auto');
            $('#toppage').width(nWinWidth - 199);//186
            }
            }
			    
			    
            if(nWinHeightNotop > nGHeight){
            $('#guid-c').height(nWinHeightNotop - 45);
            //$('#mainContent').height(nWinHeightNotop);
            $('#toppage').height(nWinHeightNotop - 22);
            $('#guidop').css('marginTop',(nWinHeightNotop /2 )-23);
            //$('#bodyWrap').height(nWinHeight);
            }else{
            //$('#mainContent').height(nGHeight);
            $('#toppage').height(nGHeight - 22);
            $('#guidop').css('marginTop',(nGHeight / 2)-23);
            //$('#bodyWrap').height(nGHeight + 133);
            }*/
        }
        setFull();
        $(window).resize(setFull);
		 
    </script>
</body>
</html>
--%>